<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
    <script type="text/javascript">
function generateBookmarklet() {
  var scriptName = document.getElementById('scriptName').value;
  var baseUrl = location.href.split('/').slice(0, -1).join('/');
  var scriptText = "javascript:(function(d,u,s){s=d.createElement('script');s.type='text/javascript';s.charset='utf-8';s.src=u;d.body.appendChild(s)})(document,'"+baseUrl+"/"+scriptName+"')";
  document.getElementById('result').innerHTML = '<a href="'+scriptText+'">'+scriptName+'</a>';
}
    </script>
	</head>
	<body>
    <h1>Bookmarklet Generator</h1>
    Script file name : 
    <input type="text" id="scriptName" value="gmap.js">
    <input type="button" onclick="generateBookmarklet()" value="Generate">
    <div id="result"></div>
	</body>
</html>

